from django.conf.urls import url

from . import views

urlpatterns = [
    # 1.注册页面
    url("^register", views.RegisterView.as_view(), name="register"),

    # 2.效验用户是否重复注册
    url("^usernames/(?P<username>[a-zA-Z0-9_-]{5,20})/count/", views.UsernameCountView.as_view()),

    # 3.效验手机号是否重复
    url("^mobiles/(?P<mobile>1[3-9]\d{9})/count/", views.MobileCountView.as_view()),

    # 4.显示登录页面
    url("^login/", views.LoginView.as_view(), name="login"),

    # 5.退出登录功能
    url("^logout/", views.LogoutView.as_view(), name="logout"),

    # 6.个人中心页面
    url("^info/$", views.UserInfoView.as_view(), name="info"),

    # 7.添加邮箱
    url("^emails/$", views.EmailView.as_view(), name="emails"),

    # 8.邮箱的回调函数
    url("^emails/verification/$", views.VerifyEmailView.as_view(), name="verifyemails"),

    # 9.收货地址
    url("^address/$", views.AddressView.as_view(), name="address"),

    # 10.新增收货地址
    url("^addresses/create/$", views.CreateAddressView.as_view(), name="createaddress"),

    # 9.修改收货地址
    url("^addresses/(?P<address_id>\d+)/$", views.UpdateAddressView.as_view(), name="updateaddress"),

    # 12 .addresses/(?P<address_id>\d+)/default/
    url(r'^addresses/(?P<address_id>\d+)/default/$', views.DefaultAddressView.as_view(), name="defaultaddress"),

    # 13.修改标题
    url(r'^addresses/(?P<address_id>\d+)/title/$', views.UpdateTitleAddressView.as_view(), name="titleaddress"),

    url(r"^password/", views.ChangePasswordView.as_view(), name="password"),

]
